﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Core;
using Entities;

namespace DAL
{
  public  class YCHoTro_KHDAL
    {
        public static List<YCHoTro_KH> LayTatCa()
        {
            try
            {
                return CBO.FillCollection<YCHoTro_KH>(DataProvider.Instance.ExecuteReader("YeuCau_HoTro_KhachHang_LayTatCa"));
            }
            catch
            {

                return new List<YCHoTro_KH>();
            }
        }
        public static bool Them(YCHoTro_KH tt)
        {
            try
            {
                object rs = DataProvider.Instance.ExecuteNonQueryWithOutput("@IDYCHoTro", "YeuCau_HoTro_KhachHang_Them", tt.IDYCHoTro, tt.TieuDe, tt.NoiDung, tt.IDTaiKhoan);
                return Convert.ToInt32(rs) > 0;

            }
            catch
            {

                return false;
            }
        }
        public static bool Sua(YCHoTro_KH tt)
        {
            try
            {
                int rs = DataProvider.Instance.ExecuteNonQuery("YeuCau_HoTro_KhachHang_Sua", tt.IDYCHoTro, tt.TieuDe, tt.NoiDung, tt.IDTaiKhoan);
                return Convert.ToInt32(rs) > 0;

            }
            catch
            {

                return false;
            }
        }
        public static bool Xoa(string ID)
        {
            try
            {
                int rs = DataProvider.Instance.ExecuteNonQuery("YeuCau_HoTro_KhachHang_Xoa", Convert.ToInt32(ID));
                return Convert.ToInt32(rs) > 0;

            }
            catch
            {

                return false;
            }
        }
    }
}
